package com.troyhigh.njrotc.admintrackerold;

public enum Category
{
    NONE ("NONE"),
    FIELD_MEET ("FIELD MEET"),
    DRILL ("DRILL"),
    ACADEMICS ("ACADEMICS"),
    COLOR_GUARD ("COLOR GUARD"),
    PT ("PT"),
    ORIENTEERING ("ORIENTEERING"),
    MARKSMANSHIP ("MARKSMANSHIP"),
    UNIT_SERVICE ("UNIT SERVICE"),
    COMMUNITY_SERVICE ("COMMUNITY SERVICE"),
    PARTICIPATION ("PARTICIPATION"),
    MINI_BOOT_CAMP ("MINI BOOT CAMP"),
    SEA_CRUISE ("SEA CRUISE"),
    OTHER ("OTHER");
    
    private String myCategory;
    Category(String cat)
    {
        myCategory = cat;
    }
    
    public static Category parseCategory(String s)
    {
        if(s == null) return NONE;
        for(Category c : values())
        {
            if(c.myCategory.equals(s))
                return c;
        }
        return NONE;            
    }
    
    public static int calculateAward(Category c, int n)
    {
        if(c.equals(COMMUNITY_SERVICE) || c.equals(UNIT_SERVICE))
        {
            return (n / 10);
        }
        else if(c.equals(PARTICIPATION))
        {
            return (n / 3);
        }
        else if(!(c.equals(NONE) || c.equals(OTHER) || c.equals(FIELD_MEET)))
        {
            return n;
        }
        return 0;
    }
    
    public static String awardAmount(int n)
    {
        switch (n)
        {
            case 1:
                return "Ribbon only";
            case 2:
                return "Ribbon, one bronze star";
            case 3:
                return "Ribbon, two bronze stars";
            case 4:
                return "Ribbon, one silver star";
            case 5:
                return "Ribbon, two silver stars";
            case 6:
                return "Ribbon, one gold star";
            case 7:
                return "Ribbon, two gold stars";
            case 8:
                return "Ribbon, three gold stars";
            default:
                return "Invalid";
        }
    }
    
    @Override
    public String toString()
    {
        return myCategory;
    }
}
